package com.daohang361.imqq.ui.file;

import java.awt.Color;

import javax.swing.Box;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class SendGetFilePanle extends JScrollPane {
	
	private Box box;
	private JPanel panel;
	private JComponent parentComponent;
	
	public SendGetFilePanle(){
		super();
		this.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		this.setBackground(Color.white);
		panel = new JPanel();
		panel.setBackground(Color.white);
		panel.setSize(150, 460);
		box=Box.createVerticalBox();//竖立的放置
		panel.add(box);
		this.setViewportView(panel);
	}
	
	public void addFilePanle(SendGetFileNode fileProgressPanle){
		box.add(fileProgressPanle);
		fileProgressPanle.setContainer(this);
		this.repaint();
	}

	public void addFile(){
		
	}
	
	public void removePanle(JPanel panel){
		box.remove(panel);
		this.repaint();
		if(box.getComponents().length==0){
			this.getParentComponent().remove(this);
		}
	}
	
	public JComponent getParentComponent() {
		return parentComponent;
	}

	public void setParentComponent(JComponent parentComponent) {
		this.parentComponent = parentComponent;
	}
}
